//验证码
function changeimg(){
    let date = new Date();
    let time = date.getTime();
    $("#img").attr("src","/getcode?"+time);
}
//登录
function login() {
    let email = $("#inputEmail").val();
    let password = $("#inputPassword").val();
    let code = $("#code").val();
    $(".text-monospace").empty();
    $.post("/login",{"email":email,"password":password,"code":code},
        function (data) {
            if (data.code===500){
                $("#lab").after("<p class='text-monospace' style='color: red'>"+data.info+"</p>");
                changeimg();
            }else {
                let s = JSON.stringify(data);
                window.sessionStorage.setItem("login",s);
                window.location.href="/html/userinfo.html";
            }
    },"json")
}